<<<<<<< HEAD
=======
/*
 * @Author: jjjjwei 1506865174@qq.com
 * @Date: 2022-08-04 19:54:48
 * @LastEditors: puyue 10857397+puyue123@user.noreply.gitee.com
 * @LastEditTime: 2022-08-16 16:19:03
 * @FilePath: \react\react-routeredux\src\store\features\userSlice.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
>>>>>>> 039e0124ae27cd35272dcd158b54ac6820d646eb
/*
 * @Author: jjjjwei 1506865174@qq.com
 * @Date: 2022-08-04 19:54:48
 * @LastEditors: jjjjwei 1506865174@qq.com
<<<<<<< HEAD
 * @LastEditTime: 2022-08-10 21:34:03
 * @FilePath: \react\react-routeredux\src\store\features\userSlice.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
/*
 * @Author: jjjjwei 1506865174@qq.com
 * @Date: 2022-08-04 19:54:48
 * @LastEditors: jjjjwei 1506865174@qq.com
=======
>>>>>>> 039e0124ae27cd35272dcd158b54ac6820d646eb
 * @LastEditTime: 2022-08-10 17:32:37
 * @FilePath: \react\react-routeredux\src\store\features\userSlice.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */
import {createSlice,createAsyncThunk} from '@reduxjs/toolkit'
import service from '../../api/index'
const initialState={
    token:sessionStorage.getItem("token")?sessionStorage.getItem("token"):"",
    user:sessionStorage.getItem("user")?JSON.parse(sessionStorage.getItem("user")):{}
}
//生成路由匹配函数

function BreadcrumbMap(arr, obj) {
    for (let i = 0; i < arr.length; i++) {
        if (arr[i].menuChilds.length > 0) {
            obj[arr[i].pathname] = arr[i].menuName
            obj = { ...obj, ...BreadcrumbMap(arr[i].menuChilds, {}) }
        } else {
            obj[arr[i].pathname] = arr[i].menuName
        }
    }
    return obj
}

// 三种状态 ，在extraReducers去侦听，进行不同处理
<<<<<<< HEAD
export const userLogin = createAsyncThunk("user/userLogin", async (userInput) => {
    // 发起axios请求
    // const res = await service.userService.UserLogin(userInput); // 相当于then传的数据 
    // console.log(res);
    const obj = {
        data: {
            menuInfo: [
                {
                    menuId: 1,
                    menuName: "首页",
                    menuUrl: "/home/home",
                    pathRoute: 'home',
                    pathname: "home",
                    componentPath: "home/Index",
                    menuImgClass: 'HomeOutlined',
                    pId: 0,
=======
export const userLogin = createAsyncThunk("user/userLogin",async (user)=>{
     // 发起axios请求
        const result = await service.userService.UserLogin(user); // 相当于then传的数据 
        console.log(result);
        const obj = {data:{menuInfo:[
            {
                menuId: 1,
                menuName: "首页",
                menuUrl: "/home/home",
                pathRoute:'home',
                pathname: "home",
                componentPath: "home/Index",
                menuImgClass: 'HomeOutlined',
                pId:0,
                menuState: "0",
                isContainChildren:false,
                menuChilds: []},
            {
                menuId: 2,
                menuName: "任务管理",
                menuUrl: "/home/taskmanage",
                pathRoute:'taskmanage',
                pathname: "taskmanage",
                componentPath: "taskmanage",
                menuImgClass: 'CarryOutOutlined',
                pId:0,
                menuState: "0",
                isContainChildren:false,
                menuChilds: [{
                    menuId: 100,
                    menuName: "我负责的任务",
                    menuUrl: "/home/taskmanage/Wofuzederenwu",
                    pathRoute:'Wofuzederenwu',
                    pathname: "Wofuzederenwu",
                    componentPath: "taskmanage/Wofuzederenwu",
                    menuImgClass: '',
                    pId:2,
>>>>>>> 039e0124ae27cd35272dcd158b54ac6820d646eb
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: []
                },
                {
                    menuId: 2,
                    menuName: "任务管理",
                    menuUrl: "/home/taskmanage",
                    pathRoute: 'taskmanage',
                    pathname: "taskmanage",
                    componentPath: "taskmanage",
                    menuImgClass: 'CarryOutOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 100,
                        menuName: "我负责的任务",
                        menuUrl: "/home/taskmanage/Wofuzederenwu",
                        pathRoute: 'Wofuzederenwu',
                        pathname: "Wofuzederenwu",
                        componentPath: "taskmanage/Wofuzederenwu",
                        menuImgClass: '',
                        pId: 2,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 101,
                        menuName: "我参与的任务",
                        menuUrl: "/home/taskmanage/Wocanyuderenwu",
                        pathRoute: 'Wocanyuderenwu',
                        pathname: "Wocanyuderenwu",
                        componentPath: "taskmanage/Wocanyuderenwu",
                        menuImgClass: '',
                        pId: 2,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 200,
                        menuName: "我创建的任务",
                        menuUrl: "/home/taskmanage/Wochuangjianderenwu",
                        pathRoute: 'Wochuangjianderenwu',
                        pathname: "Wochuangjianderenwu",
                        componentPath: "taskmanage/Wochuangjianderenwu",
                        menuImgClass: '',
                        pId: 2,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 210,
                        menuName: "已归档任务",
                        menuUrl: "/home/taskmanage/Yiguidangrenwu",
                        pathRoute: 'Yiguidangrenwu',
                        pathname: "Yiguidangrenwu",
                        componentPath: "taskmanage/Yiguidangrenwu",
                        menuImgClass: '',
                        pId: 2,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    },]
                },
                // 项目管理
                {
                    menuId: 3,
                    menuName: "项目管理",
                    menuUrl: "/home/projectmanage",
                    pathRoute: 'projectmanage',
                    pathname: "projectmanage",
                    componentPath: "projectmanage",
                    menuImgClass: 'GoldOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 102,
                        menuName: "投标管理",
                        menuUrl: "/home/projectmanage/Toubiaoguanli",
                        pathRoute: 'Toubiaoguanli',
                        pathname: "Toubiaoguanli",
                        componentPath: "projectmanage/Toubiaoguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 3,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 103,
                        menuName: "项目管理",
                        menuUrl: "/home/projectmanage/Xiangmuguanli",
                        pathRoute: 'Xiangmuguanli',
                        pathname: "Xiangmuguanli",
                        componentPath: "projectmanage/Xiangmuguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 3,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },
                // 合同管理
                {
                    menuId: 4,
                    menuName: "合同管理",
                    menuUrl: "/home/contractmanage",
                    pathRoute: 'contractmanage',
                    pathname: "contractmanage",
                    componentPath: "contractmanage",
                    menuImgClass: 'AuditOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 104,
                        menuName: "材料采购合同",
                        menuUrl: "/home/contractmanage/Cailiaocaigouhetong",
                        pathRoute: 'Cailiaocaigouhetong',
                        pathname: "Cailiaocaigouhetong",
                        componentPath: "contractmanage/Cailiaocaigouhetong",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 4,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 105,
                        menuName: "施工班组合同",
                        menuUrl: "/home/contractmanage/Shigonghetong",
                        pathRoute: 'Shigonghetong',
                        pathname: "Shigonghetong",
                        componentPath: "contractmanage/Shigonghetong",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 4,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 106,
                        menuName: "项目合同",
                        menuUrl: "/home/contractmanage/Xiangmuhetong",
                        pathRoute: 'Xiangmuhetong',
                        pathname: "Xiangmuhetong",
                        componentPath: "contractmanage/Xiangmuhetong",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 4,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },
                // 审批管理
                {
                    menuId: 5,
                    menuName: "审批管理",
                    menuUrl: "/home/examinemanage",
                    pathRoute: 'examinemanage',
                    pathname: "examinemanage",
                    componentPath: "examinemanage",
                    menuImgClass: 'SolutionOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 107,
                        menuName: "我发起的审批",
                        menuUrl: "/home/examinemanage/Wofaqideshenpi",
                        pathRoute: 'Wofaqideshenpi',
                        pathname: "Wofaqideshenpi",
                        componentPath: "examinemanage/Wofaqideshenpi",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 5,
                        menuState: "0",
                        isContainChildren: true,
                        isChildren: false,
                        menuChilds: [{
                            menuId: 201,
                            menuName: "班组付款申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Banzufukuanshenqing",
                            pathRoute: 'Banzufukuanshenqing',
                            pathname: "Banzufukuanshenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Banzufukuanshenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 202,
                            menuName: "材料采购付款申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Cailiaocaigoufukuanshenqing",
                            pathRoute: 'Cailiaocaigoufukuanshenqing',
                            pathname: "Cailiaocaigoufukuanshenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Cailiaocaigoufukuanshenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 203,
                            menuName: "临时付款申请",
                            ismenu: true,

                            menuUrl: "/home/examinemanage/wofaqideshenpi/linshifukuanshenqing",

                            pathRoute: 'linshifukuanshenqing',
                            pathname: "linshifukuanshenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Linshifukuanshenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 204,
                            menuName: "用章申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Yongzhangshenqing",

                            pathRoute: 'Yongzhangshenqing',
                            pathname: "Yongzhangshenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Yongzhangshenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 205,
                            menuName: "选样申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Xuanyangshenqing",

                            pathRoute: 'Xuanyangshenqing',
                            pathname: "Xuanyangshenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Xuanyangshenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 206,
                            menuName: "联系单签发申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Lianxidanqianfashenqing",

                            pathRoute: 'Lianxidanqianfashenqing',
                            pathname: "Lianxidanqianfashenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Lianxidanqianfashenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 207,
                            menuName: "材料采购申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Cailiaocaigoushenqing",

                            pathRoute: 'Cailiaocaigoushenqing',
                            pathname: "Cailiaocaigoushenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Cailiaocaigoushenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 208,
                            menuName: "劳务申请",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wofaqideshenpi/Laowushenqing",

                            pathRoute: 'Laowushenqing',
                            pathname: "Laowushenqing",
                            componentPath: "examinemanage/wofaqideshenpi/Laowushenqing",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }]
                    }, {
                        menuId: 108,
                        menuName: "我经办的审批",
                        menuUrl: "/home/examinemanage/Wojingbandeshenpi",
                        pathRoute: 'Wojingbandeshenpi',
                        pathname: "Wojingbandeshenpi",
                        componentPath: "examinemanage/Wojingbandeshenpi",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 5,
                        menuState: "0",
                        isContainChildren: true,
                        isChildren: false,
                        menuChilds: [{
                            menuId: 201,
                            menuName: "班组付款申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Banzufukuanshenqingshenpi",
                            pathRoute: 'Banzufukuanshenqingshenpi',
                            pathname: "Banzufukuanshenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Banzufukuanshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 202,
                            menuName: "材料采购付款申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Cailiaocaigoufukuanshenqingshenpi",
                            pathRoute: 'Cailiaocaigoufukuanshenqingshenpi',
                            pathname: "Cailiaocaigoufukuanshenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Cailiaocaigoufukuanshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 203,
                            menuName: "临时付款申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Linshifukuanshenqingshenpi",
                            pathRoute: 'linshifukuanshenqingshenpi',
                            pathname: "linshifukuanshenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Linshifukuanshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 204,
                            menuName: "用章申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Yongzhangshenqingshenpi",
                            pathRoute: 'Yongzhangshenqingshenpi',
                            pathname: "Yongzhangshenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Yongzhangshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 205,
                            menuName: "选样申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Xuanyangshenqingshenpi",
                            pathRoute: 'Xuanyangshenqingshenpi',
                            pathname: "Xuanyangshenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Xuanyangshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 206,
                            menuName: "联系单签发申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Lianxidanqianfashenqingshenpi",
                            pathRoute: 'Lianxidanqianfashenqingshenpi',
                            pathname: "Lianxidanqianfashenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Lianxidanqianfashenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 207,
                            menuName: "材料采购申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Cailiaocaigoushenqingshenpi",
                            pathRoute: 'Cailiaocaigoushenqingshenpi',
                            pathname: "Cailiaocaigoushenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Cailiaocaigoushenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 208,
                            menuName: "劳务申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/wojingbandeshenpi/Laowushenqingshenpi",
                            pathRoute: 'Laowushenqingshenpi',
                            pathname: "Laowushenqingshenpi",
                            componentPath: "examinemanage/wojingbandeshenpi/Laowushenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }]
                    }, {
                        menuId: 109,
                        menuName: "抄送给我的审批",
                        menuUrl: "/home/examinemanage/Chaosonggeiwodeshenpi",
                        pathRoute: 'Chaosonggeiwodeshenpi',
                        pathname: "Chaosonggeiwodeshenpi",
                        componentPath: "examinemanage/Chaosonggeiwodeshenpi",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 5,
                        menuState: "0",
                        isContainChildren: true,
                        isChildren: false,
                        menuChilds: [{
                            menuId: 201,
                            menuName: "班组付款申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Banzufukuanshenqingshenpi",
                            pathRoute: 'Banzufukuanshenqingshenpi',
                            pathname: "Banzufukuanshenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Banzufukuanshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 202,
                            menuName: "材料采购付款申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Cailiaocaigoufukuanshenqingshenpi",
                            pathRoute: 'Cailiaocaigoufukuanshenqingshenpi',
                            pathname: "Cailiaocaigoufukuanshenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Cailiaocaigoufukuanshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 203,
                            menuName: "临时付款申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Linshifukuanshenqingshenpi",
                            pathRoute: 'linshifukuanshenqingshenpi',
                            pathname: "linshifukuanshenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Linshifukuanshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 204,
                            menuName: "用章申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Yongzhangshenqingshenpi",
                            pathRoute: 'Yongzhangshenqingshenpi',
                            pathname: "Yongzhangshenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Yongzhangshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 205,
                            menuName: "选样申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Xuanyangshenqingshenpi",
                            pathRoute: 'Xuanyangshenqingshenpi',
                            pathname: "Xuanyangshenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Xuanyangshenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 206,
                            menuName: "联系单签发申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Lianxidanqianfashenqingshenpi",
                            pathRoute: 'Lianxidanqianfashenqingshenpi',
                            pathname: "Lianxidanqianfashenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Lianxidanqianfashenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 207,
                            menuName: "材料采购申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Cailiaocaigoushenqingshenpi",
                            pathRoute: 'Cailiaocaigoushenqingshenpi',
                            pathname: "Cailiaocaigoushenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Cailiaocaigoushenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }, {
                            menuId: 208,
                            menuName: "劳务申请审批",
                            ismenu: true,
                            menuUrl: "/home/examinemanage/chaosonggeiwodeshenpi/Laowushenqingshenpi",
                            pathRoute: 'Laowushenqingshenpi',
                            pathname: "Laowushenqingshenpi",
                            componentPath: "examinemanage/chaosonggeiwodeshenpi/Laowushenqingshenpi",
                            menuImgClass: 'VideoCameraAddOutlined',
                            pId: 107,
                            menuState: "0",
                            isContainChildren: false,
                            menuChilds: []
                        }]
                    }]
                },
                // 招采管理
                {
                    menuId: 6,
                    menuName: "招采管理",
                    menuUrl: "/home/procurementmanage",
                    pathRoute: 'procurementmanage',
                    pathname: "procurementmanage",
                    componentPath: "procurementmanage",
                    menuImgClass: 'ShoppingCartOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 110,
                        menuName: "供应商管理",
                        menuUrl: "/home/procurementmanage/Gongyingshangguanli",
                        pathRoute: 'Gongyingshangguanli',
                        pathname: "Gongyingshangguanli",
                        componentPath: "procurementmanage/Gongyingshangguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 6,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 111,
                        menuName: "施工班组管理",
                        menuUrl: "/home/procurementmanage/Shigongbanzuguanli",
                        pathRoute: 'Shigongbanzuguanli',
                        pathname: "Shigongbanzuguanli",
                        componentPath: "procurementmanage/Shigongbanzuguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 6,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 112,
                        menuName: "采购计划管理",
                        menuUrl: "/home/procurementmanage/Caigoujihuaguanli",
                        pathRoute: 'Caigoujihuaguanli',
                        pathname: "Caigoujihuaguanli",
                        componentPath: "procurementmanage/Caigoujihuaguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 6,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },
                // 人事行政
                {
                    menuId: 7,
                    menuName: "人事行政",
                    menuUrl: "/home/personnelmanage",
                    pathRoute: 'personnelmanage',
                    pathname: "personnelmanage",
                    componentPath: "personnelmanage",
                    menuImgClass: 'TeamOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 113,
                        menuName: "新闻公告",
                        menuUrl: "/home/personnelmanage/Xinwengonggao",
                        pathRoute: 'Xinwengonggao',
                        pathname: "Xinwengonggao",
                        componentPath: "personnelmanage/Xinwengonggao",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 7,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 113,
                        menuName: "考勤统计",
                        menuUrl: "/home/personnelmanage/Kaoqintongji",
                        pathRoute: 'Kaoqintongji',
                        pathname: "Kaoqintongji",
                        componentPath: "personnelmanage/Kaoqintongji",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 7,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },
                // 财务管理
                {
                    menuId: 8,
                    menuName: "财务管理",
                    menuUrl: "/home/financialmanage",
                    pathRoute: 'financialmanage',
                    pathname: "financialmanage",
                    componentPath: "financialmanage",
                    menuImgClass: 'PropertySafetyOutlined',
                    pId: 0,
                    menuState: "0",
<<<<<<< HEAD
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 114,
                        menuName: "台账管理",
                        menuUrl: "/home/financialmanage/Taizhangguanli",
                        pathRoute: 'Taizhangguanli',
                        pathname: "Taizhangguanli",
                        componentPath: "financialmanage/Taizhangguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 8,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 115,
                        menuName: "付款记录",
                        menuUrl: "/home/financialmanage/Fukuanjilu",
                        pathRoute: 'Fukuanjilu',
                        pathname: "Fukuanjilu",
                        componentPath: "financialmanage/Fukuanjilu",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 8,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 116,
                        menuName: "收款记录",
                        menuUrl: "/home/financialmanage/Shoukuanjilu",
                        pathRoute: 'Shoukuanjilu',
                        pathname: "Shoukuanjilu",
                        componentPath: "financialmanage/Shoukuanjilu",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 8,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },
                // 知识库管理
                {
                    menuId: 9,
                    menuName: "知识库管理",
                    menuUrl: "/home/knowledgebasemanage",
                    pathRoute: 'knowledgebasemanage',
                    pathname: "knowledgebasemanage",
                    componentPath: "knowledgebasemanage",
                    menuImgClass: 'ReadOutlined',
                    pId: 0,
=======
                    isContainChildren:false,
                    menuChilds: []
                },{
                    menuId: 151,
                    menuName: "供应商编辑",
                    ismenu: 'true',
                    menuUrl: "/home/procurementmanage/Addgongyingshang",
                    pathRoute:'Addgongyingshang',
                    pathname: "Addgongyingshang",
                    componentPath: "procurementmanage/Addgongyingshang",
                    menuImgClass: 'VideoCameraAddOutlined',
                    pId:6,
                    menuState: "0",
                    isContainChildren:false,
                    menuChilds: []
                },{
                    menuId: 152,
                    menuName: "供应商详情",
                    ismenu: 'true',
                    menuUrl: "/home/procurementmanage/Gongyingshangdetails",
                    pathRoute:'Gongyingshangdetails',
                    pathname: "Gongyingshangdetails",
                    componentPath: "procurementmanage/Gongyingshangdetails",
                    menuImgClass: 'VideoCameraAddOutlined',
                    pId:6,
                    menuState: "0",
                    isContainChildren:false,
                    menuChilds: []
                }]
            },
            // 人事行政
            {
                menuId: 7,
                menuName: "人事行政",
                menuUrl: "/home/personnelmanage",
                pathRoute:'personnelmanage',
                pathname: "personnelmanage",
                componentPath: "personnelmanage",
                menuImgClass: 'TeamOutlined',
                pId:0,
                menuState: "0",
                isContainChildren:false,
                menuChilds: [{
                    menuId: 113,
                    menuName: "新闻公告",
                    menuUrl: "/home/personnelmanage/Xinwengonggao",
                    pathRoute:'Xinwengonggao',
                    pathname: "Xinwengonggao",
                    componentPath: "personnelmanage/Xinwengonggao",
                    menuImgClass: 'VideoCameraAddOutlined',
                    pId:7,
>>>>>>> 039e0124ae27cd35272dcd158b54ac6820d646eb
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 117,
                        menuName: "知识库列表",
                        menuUrl: "/home/knowledgebasemanage/Zhishikuliebiao",
                        pathRoute: 'Zhishikuliebiao',
                        pathname: "Zhishikuliebiao",
                        componentPath: "knowledgebasemanage/Zhishikuliebiao",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 9,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 118,
                        menuName: "分类管理",
                        menuUrl: "/home/knowledgebasemanage/Fenleiguanli",
                        pathRoute: 'Fenleiguanli',
                        pathname: "Fenleiguanli",
                        componentPath: "knowledgebasemanage/Fenleiguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 9,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    },]
                },
                // 组织管理
                {
                    menuId: 10,
                    menuName: "组织管理",
                    menuUrl: "/home/organizationmanage",
                    pathRoute: 'organizationmanage',
                    pathname: "organizationmanage",
                    componentPath: "organizationmanage",
                    menuImgClass: 'ApartmentOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 119,
                        menuName: "部门管理",
                        menuUrl: "/home/organizationmanage/Bumenguanli",
                        pathRoute: 'Bumenguanli',
                        pathname: "Bumenguanli",
                        componentPath: "organizationmanage/Bumenguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 10,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 120,
                        menuName: "岗位管理",
                        menuUrl: "/home/organizationmanage/Gangweiguanli",
                        pathRoute: 'Gangweiguanli',
                        pathname: "Gangweiguanli",
                        componentPath: "organizationmanage/Gangweiguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 10,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 121,
                        menuName: "员工管理",
                        menuUrl: "/home/organizationmanage/Yuangongguanli",
                        pathRoute: 'Yuangongguanli',
                        pathname: "Yuangongguanli",
                        componentPath: "organizationmanage/Yuangongguanli",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 10,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }, {
                        menuId: 122,
                        menuName: "编辑",
                        ismenu: 'true',
                        menuUrl: "/home/organizationmanage/Gangwei/GangweiChange",
                        pathRoute: 'Gangwei/GangweiChange',
                        pathname: "Gangwei/GangweiChange",
                        componentPath: "organizationmanage/Gangwei/GangweiChange",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 10,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },
                // 设置
                {
                    menuId: 11,
                    menuName: "设置",
                    menuUrl: "/home/setting",
                    pathRoute: 'setting',
                    pathname: "setting",
                    componentPath: "setting",
                    menuImgClass: 'SettingOutlined',
                    pId: 0,
                    menuState: "0",
                    isContainChildren: false,
                    menuChilds: [{
                        menuId: 123,
                        menuName: "审批流程设置",
                        menuUrl: "/home/setting/Shenpiliuchengshezhi",
                        pathRoute: 'Shenpiliuchengshezhi',
                        pathname: "Shenpiliuchengshezhi",
                        componentPath: "setting/Shenpiliuchengshezhi",
                        menuImgClass: 'VideoCameraAddOutlined',
                        pId: 11,
                        menuState: "0",
                        isContainChildren: false,
                        menuChilds: []
                    }]
                },

            ], userInfo: { headerImg: 'headerImg.png' }
        }, returnCode: 200, token: '123456'
    }
    const res = BreadcrumbMap(obj.data.menuInfo, {})
    console.log(res, 111);
    obj.res = res
    return obj;
})

// 
export const { reducer, actions } = createSlice({
    name: "userSlice",
    initialState,
    reducers: { //纯函数，不能写异步操作
        setMianbaoxie: function (state, action) {
            state.list = action.payload
            sessionStorage.setItem('list', JSON.stringify(action.payload))
        }
    },
    extraReducers: {
        // userLogin return 的值放在action.payload属性
        // payload: 负载
       [userLogin.fulfilled](state,{payload}){
           state.token = payload.token;
           state.user = payload.data;
           //将state更新的值同步更新到sessionStorage中
           sessionStorage.setItem("token",payload.token);
           sessionStorage.setItem("user",JSON.stringify(payload.data));
<<<<<<< HEAD

=======
           sessionStorage.setItem("res",JSON.stringify(payload.res));
>>>>>>> 039e0124ae27cd35272dcd158b54ac6820d646eb
           console.log("fulfilled",payload);
       },
       [userLogin.pending](state){
        // console.log("pending");
       },
       [userLogin.rejected](state){
        console.log("rejected");
       }
    }
})